package com.tuanzi.loan.business.service.extratemplate.impl;

import com.tuanzi.loan.business.entity.extratemplate.ExtraTemplateSpecial;
import com.tuanzi.loan.business.repository.extratemplate.ExtraTemplateSpecialRepository;
import com.tuanzi.loan.business.service.extratemplate.ExtraTemplateSpecialService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author caiwanlin
 * @create 2018-10-16 14:39
 */
@Debug
@Service
@Transactional
@Retryable(value = {RetryException.class})
public class ExtraTemplateSpecialServiceImpl extends BaseAuditServiceImpl<ExtraTemplateSpecial,Long> implements ExtraTemplateSpecialService {
    @Autowired
    private ExtraTemplateSpecialRepository extraTemplateSpecialRepository;
    @Override
    protected JPAAuditRepository<ExtraTemplateSpecial, Long> getRepository() {
        return extraTemplateSpecialRepository;
    }

    @Override
    public List<ExtraTemplateSpecial> findAllByTemplateId(Integer templateId) {
        return extraTemplateSpecialRepository.findAllByTemplateId(templateId);
    }

    @Override
    public void deleteAllByTemplateId(Long templateId) {
        extraTemplateSpecialRepository.deleteAllByTemplateId(templateId);
    }

    @Override
    public void deleteAllByTemplateId(Integer templateId) {
        extraTemplateSpecialRepository.deleteAllByTemplateId(templateId);
    }
}
